<template>
  <div v-show="show" v-cloak>
    <div class="artice">
      <h3>{{detail.ar_title}}</h3>
      <p>
        <span class="fr">上传人:{{detail.ar_author}}</span>
        <span>{{detail.time}}</span>
      </p>
      <div v-html="detail.ar_content" class="artice_con"></div>
    </div>
  </div>
</template>
<script>
  import 'iview/dist/styles/iview.css'
  export default {
    name: 'anwerlist',
    components: {
    },
    data () {
      return {
        ar_id: '',
        show: false,
        page: 0,
        limit: 6,
        detail: {},
        questionAjax: true,
        count: 0,
        cate: '',
        type: null,
        ca_id: -1
      }
    },
    methods: {
      getArticledetail: function () {
        let thisObj = this
        if (!thisObj.questionAjax) {
          return false
        }
        thisObj.questionAjax = false
        // 获取问答列表
        thisObj.$chaos.ajax({
          data: {
            ar_id: thisObj.ar_id
          },
          slient: true,
          userinfo: false,
          url: 'User/getArticleDetail',
          callback: function (type, res) {
            thisObj.questionAjax = true
            thisObj.show = true
            if (res.status === 'SUCCESS') {
              let crumbs = []
              if (thisObj.cate === '1') {
                crumbs[0] = {
                  title: res.result.list.ar_title,
                  link: ''
                }
              } else {
                if (thisObj.type) {
                  crumbs[0] = {
                    title: thisObj.type,
                    link: ''
                  }
                  crumbs[1] = {
                    title: thisObj.cate,
                    link: '/Revehicle/ServiceCase?ca_id=' + thisObj.ca_id + '&type=' + thisObj.type
                  }
                  crumbs[2] = {
                    title: res.result.list.ar_title,
                    link: ''
                  }
                } else {
                  crumbs[0] = {
                    title: thisObj.cate,
                    link: '/Revehicle/ServiceCase'
                  }
                  crumbs[1] = {
                    title: res.result.list.ar_title,
                    link: ''
                  }
                }
              }
              thisObj.$store.commit('crumbs', crumbs)
              thisObj.detail = res.result.list
            } else {
              thisObj.$vux.toast.show({
                text: res.result.msg,
                type: 'text',
                width: '180px',
                position: 'bottom'
              })
            }
          }
        })
      },
      verify: function () {
        let thisObj = this
        thisObj.ar_id = thisObj.$chaos.getQueryString('ar_id')
        thisObj.cate = decodeURI(thisObj.$chaos.getQueryString('cate'))
        if (decodeURI(thisObj.$chaos.getQueryString('type'))) {
          thisObj.type = decodeURI(thisObj.$chaos.getQueryString('type'))
        }
        if (decodeURI(thisObj.$chaos.getQueryString('ca_id'))) {
          thisObj.ca_id = decodeURI(thisObj.$chaos.getQueryString('ca_id'))
        }
//        thisObj.$chaos.setTitle(thisObj.cate)
        thisObj.getArticledetail()
      }
    },
    created: function () {
      this.verify()
    }
  }
</script>
<style>
  .top_klj>div>span{
    font-size: 16px;
  }
  .main-title span{
    font-size: 16px!important;
  }
  /*分页样式*/
  .ivu-page-total{
    vertical-align: -2px;
  }
  .ivu-page-item-active{
    background: #2d8cf0!important;
  }
  .ivu-page-item-active a, .ivu-page-item-active:hover a{
    color: #fff!important;
  }
  .ivu-page-item{
    border:1px solid #2d8cf0!important;
  }
  .ivu-page-item-jump-next, .ivu-page-item-jump-prev{
    position: relative!important;
  }
  .ivu-page-item-jump-next:after, .ivu-page-item-jump-prev:after{
    position: absolute;
    top: 0px;
  }
  /*分页样式*/
</style>
<style scoped>
  .artice h3{
    font-size: 22px;
    text-align: center;
    line-height: 40px;
    margin: 20px 0px 30px;
  }
  .fr{
    float: right;
  }
  .artice>p{
    width:350px;
    font-size: 15px;
    color: #6d6d6d;
    margin-bottom: 15px;
  }
  .artice_con{
    font-size: 16px;
    line-height: 35px;
    color: #000;
  }
</style>
